package com.example.awale;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.Toast;

public class AwaleIA extends Activity {
	private GridView grille;
	private ia i = new ia();
	private ImageAdapter img = new ImageAdapter(this); 

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_awale_i);
		i.init();
		grille=(GridView)findViewById(R.id.gridView1);
		grille.setAdapter(img);
		
		   grille.setOnItemClickListener(new OnItemClickListener() {
		        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
		            Toast.makeText(AwaleIA.this, "" + position, Toast.LENGTH_SHORT).show();
		            i.jouejoueur(position);
		            img.initPosition(i.getposi());
		            img.notifyDataSetChanged();
		            grille.setAdapter(img);
		            
		        }
		    });
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.awale_i, menu);
		return true;
	}

	public void initValeur()
	{
		
	}
}

